package footballmanager;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Created by thoughtworker on 1/16/14.
 */
public class FootballManager {

    private PrintStream printStream;
    private static Set<Player> playerObjectsList;

    public FootballManager(PrintStream printStream) {
        this.printStream = printStream;
    }

    public void run() {
        FootballManagerMenu footballManagerMenu = new FootballManagerMenu();
        footballManagerMenu.printOptions();

    }

    public void printNames(List<String> playerNameList) {
        for(String player: playerNameList){
            printStream.println(player);
        }
    }

    public void printPlayerList(Set<Player> playerObjectsList) {
        for(Player player : playerObjectsList){
            printStream.println(player.toString());
        }
    }

    public String findPlayer(String name, int jerseyNumber) {
        String result = "";
        for(Player player: playerObjectsList){
            if(name.equals(player.getName()) && jerseyNumber == player.getJerseyNumber()){
              result = player.toString();
            }
            else{
                result = "Please try again.";
            }
        }
        return result;

        }
}

